package com.ltmonitor.video.entity;

import com.ltmonitor.util.DateUtil;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 录像文件
 */

@Entity
@Table(name="VideoFileItem")
@org.hibernate.annotations.Proxy(lazy = false)
@Inheritance(strategy= InheritanceType.TABLE_PER_CLASS)
public class VideoFileItem implements Serializable{
    /**
     * 未上传
     */
    public static String STATUS_NOT_UPLOAD = "not_upload";
    /**
     * 上传完成
     */
    public static String STATUS_UPLOAD_COMPLTETED = "upload_completed";
    /**
     * 上传中
     */
    public static String STATUS_UPLOADING = "uploading";

    /**
     * 终端上传失败
     */
    public static String STATUS_UPLOAD_FAILED = "upload_failed";

    /**
     * 上传被用户取消
     */
    public static String STATUS_UPLOAD_CANCELED = "upload_canceled";

    /**
     * 上传被用户暂停
     */
    public static String STATUS_UPLOAD_PAUSED = "upload_paused";


    /**
     * 设备离线，没有数据上传
     */
    public static String STATUS_OFFLINE = "upload_offline";
    /**
     * 停止录像
     */
    public static String STATUS_STOP_RECORD = "stop_record";


    /**
     * 终端的FTP文件
     */
    public static String FROM_FTP = "ftp";

    /**
     * 终端上传的资源目录,只是存储的目录，服务器并没有真实的文件对应
     */
    public static String FROM_TERMINAL = "terminal";

    /**
     * 用户手动录像文件
     */
    public static String FROM_USER = "user_recorder";

    /**
     * 服务器主动录像文件
     */
    public static String FROM_SERVER = "server_recorder";

    public VideoFileItem()
    {
        createDate = new Date();
        fileSource = FROM_TERMINAL;
        status = STATUS_NOT_UPLOAD;
        uploadDate = new Date();
    }
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "baseId", unique = true, nullable = false)
    private long entityId;

    private long vehicleId;

    private String simNo;

    private String plateNo;
    /**
     * 对应下发查询指令的Id
     */
    private long commandId;

    /// <summary>
    /// 通道ID
    /// </summary>
    private byte channelId;

    /// <summary>
    /// 开始时间
    /// </summary>
    private Date startDate;

    /// <summary>
    /// 结束时间
    /// </summary>
    private Date endDate;
    /// <summary>
    /// 报警标志位
    /// </summary>
    private long alarmStatus;
    /**
     * 文件上传的完成状态 0 未上传  1上传完成 2上传命令执行成功，等待上传
     */
    private String status;
    /**
     * 来源：ftp，terminal,record
     */
    private String fileSource;
    /**
     * 文件上传位置
     */
    private String filePath;

    private double latitude1;

    private double longitude1;

    private double latitude2;

    private double longitude2;


    /// <summary>
    /// 音视频资源类型
    /// </summary>
    private byte dataType;
    /// <summary>
    /// 码流类型，0： 主码流 1：子码流
    /// </summary>
    private byte streamType;

    /// <summary>
    /// 存储器类型 0 ：所有存储器 1: 主存储 2：灾备
    /// </summary>
    private byte storeType;
    /// <summary>
    /// 文件大小
    /// </summary>
    private long fileLength;

    private Date createDate;

    /**
     * 状态更新时间
     */
    private Date uploadDate;

    public byte getChannelId() {
        return channelId;
    }

    public void setChannelId(byte channelId) {
        this.channelId = channelId;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public long getAlarmStatus() {
        return alarmStatus;
    }

    public void setAlarmStatus(long alarmStatus) {
        this.alarmStatus = alarmStatus;
    }

    public byte getDataType() {
        return dataType;
    }

    public void setDataType(byte dataType) {
        this.dataType = dataType;
    }

    public byte getStreamType() {
        return streamType;
    }

    public void setStreamType(byte streamType) {
        this.streamType = streamType;
    }

    public byte getStoreType() {
        return storeType;
    }

    public void setStoreType(byte storeType) {
        this.storeType = storeType;
    }

    public long getFileLength() {
        return fileLength;
    }

    public void setFileLength(long fileLength) {
        this.fileLength = fileLength;
    }

    public long getEntityId() {
        return entityId;
    }

    public void setEntityId(long entityId) {
        this.entityId = entityId;
    }

    /**
     * 下发的指令Id
     */
    public long getCommandId() {
        return commandId;
    }

    public void setCommandId(long commandId) {
        this.commandId = commandId;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    /**
     * 文件上传状态
     */
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public long getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(long vehicleId) {
        this.vehicleId = vehicleId;
    }

    public String getPlateNo() {
        return plateNo;
    }

    public void setPlateNo(String plateNo) {
        this.plateNo = plateNo;
    }

    /**
     * 文件来源，Terminal, Ftp
     */
    public String getFileSource() {
        return fileSource;
    }

    public void setFileSource(String fileSource) {
        this.fileSource = fileSource;
    }

    /**
     * 文件路径
     */
    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public Date getUploadDate() {
        return uploadDate;
    }

    public void setUploadDate(Date uploadDate) {
        this.uploadDate = uploadDate;
    }

    public String getSimNo() {
        return simNo;
    }

    public void setSimNo(String simNo) {
        this.simNo = simNo;
    }

    public double getLatitude1() {
        return latitude1;
    }

    public void setLatitude1(double latitude1) {
        this.latitude1 = latitude1;
    }

    public double getLongitude1() {
        return longitude1;
    }

    public void setLongitude1(double longitude1) {
        this.longitude1 = longitude1;
    }

    public double getLatitude2() {
        return latitude2;
    }

    public void setLatitude2(double latitude2) {
        this.latitude2 = latitude2;
    }

    public double getLongitude2() {
        return longitude2;
    }

    public void setLongitude2(double longitude2) {
        this.longitude2 = longitude2;
    }
}
